<!--
 * @Author: '浪川' '1214391613@qq.com'
 * @Date: 2025-06-18 16:37:49
 * @LastEditors: '浪川' '1214391613@qq.com'
 * @LastEditTime: 2025-08-09 10:39:33
 * @FilePath: \passiflora-edulis-sims\src\App.vue
 * @Description:
 *
 * Copyright (c) 2025 by '1214391613@qq.com', All Rights Reserved.
-->
<template>
  <router-view />
</template>

<script setup lang="ts">
import 'src/utils/proxyData' // 引入 leaferjs 的响应式
import { useGlobalOptionStore } from './stores/global-option-store'
import { onMounted } from 'vue'
import { useGlobalTextStore } from './stores/global-text-store'
import { loadFont } from './utils/FontUtil'
import { useGeneralPuzzleStore } from './stores/CreateBook/general-puzzle-store'
import { useCrosswordStore } from './stores/crossword-store'
import { useWordSearchIStore } from './stores/wordsearch-store'

const global_optin_store = useGlobalOptionStore()
const global_text_store = useGlobalTextStore()
// 标题
const base_text_store = useGeneralPuzzleStore()

// crossword
const crossword_store = useCrosswordStore()

// wordsearch
const word_search_store = useWordSearchIStore()
onMounted(() => {
  // 读取所有的字体
  global_optin_store.readFontList()
  // 为不同的IText属性 进行字体初始化
  const font_name_default = global_optin_store.font_names[0]
  if (font_name_default != undefined) {
    global_text_store.font.font_name = font_name_default
    base_text_store.title.font.font_name = font_name_default
    base_text_store.instruction.font.font_name = font_name_default

    crossword_store.legend_type.font.font_name = font_name_default

    word_search_store.words_legend.font.font_name = font_name_default
    void loadFont(
      font_name_default,
      global_optin_store.get_fontPath(font_name_default),
      {
        family: font_name_default,
        weight: '400',
        display: 'swap',
      }
    )
  }
})
</script>
